package pkg

import (
	"encoding/json"
	"fmt"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
)

type Censor struct {
	ConclusionType uint `json:"conclusionType"`
}

func TextCensor(content string) bool {

	client := censor.NewClient("E1kxZW8WN2tbXu0KiVbCIQCK", "xNwHgQLCFSkC0u5cAIv4lpgSDM0orT6t")
	res := client.TextCensor(content)
	fmt.Println(res)

	var result Censor
	json.Unmarshal([]byte(res), &result)
	if result.ConclusionType == 1 {
		return true
	}
	return false
}
